package com.example.bluebrocastapp

import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import com.example.bluejumplib.ConnectInterface
import com.example.bluejumplib.JumpHandler
import felhr.ADV_Data.ADVData
import felhr.usbservice.ADV_Callback
import java.lang.ref.WeakReference
import java.util.ArrayList

class MainActivity : AppCompatActivity() {
    private  val TAG = "MainActivity"
    val jumpHandler:JumpHandler= JumpHandler()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        jumpHandler.init(object :ADV_Callback{
            override fun gotData_Callback(ADVDatas: ArrayList<ADVData>?) {
                Log.i(TAG, "gotData_Callback: ")
            }

            override fun heart_beat_Callback() {
            }

        })
    }

    override fun onResume() {
        super.onResume()
        jumpHandler.startJumpService(WeakReference<Context>(baseContext).get()) { state->Log.i(TAG, "state: "+state) }
    }

    override fun onPause() {
        super.onPause()
        jumpHandler.release()
    }
}